/**
 * Created by Administrator on 14-2-10.
 */
var mongoose = require('mongoose');
var timestamps = require('mongoose-timestamp');//(给Model自动添加createdAt和updatedAt):

var Schema = mongoose.Schema,
    ObjectId = Schema.ObjectId;

// Schema 结构
var schema = new Schema({
    // _id:ObjectId, // default id
    api_name:String,     // api name
    device:Number,       // 见各api接口的device参数
    userId:Number
});
//Adding static methods to a Model
schema.statics.staticFunction = function(config, callback) {
    return this.find(config,function(error, items){
        console.log(items);
        callback(error, items);
    });
};
// built-in instance methods
schema.methods.instanceFunction = function(config, callback){
    this.model('MAPILogModel').find(config,function(error, items){
        console.log(items);
        callback(error, items);
    });

};
schema.plugin(timestamps);
mongoose.model('MAPILogModel', schema, 'MAPILog');

